<template>
  <div class="login-container">
    <!-- 添加logo图片 -->
    <div class="login-logo">
      <img src="../logo/1.png" alt="系统logo" class="logo-img">
    </div>

    <div class="login-box">
      <div class="login-header">
        <h2 class="login-title">登录</h2>
        <p class="login-subtitle">欢迎回来，请登录您的账号</p>
      </div>
      <form class="login-form">
        <div class="form-group">
          <div class="input-group">
            <span class="input-icon"><i class="icon-user"></i></span>
            <input type="text" id="username" v-model="loginForm.username" class="form-control animated-input"
              @focus="handleInputFocus('username')" @blur="handleInputBlur('username')"
              @input="handleInputChange('username')">
            <div class="floating-placeholder" :class="{ 'active': usernameActive || usernameHasContent }">
              <span v-for="(char, index) in '请输入账号'" :key="index" :style="{ transitionDelay: index * 0.05 + 's' }">{{
                char }}</span>
            </div>
          </div>
        </div>
        <div class="form-group">
          <div class="input-group">
            <span class="input-icon"><i class="icon-lock"></i></span>
            <input type="password" id="password" v-model="loginForm.password" class="form-control animated-input"
              @focus="handleInputFocus('password')" @blur="handleInputBlur('password')"
              @input="handleInputChange('password')">
            <div class="floating-placeholder" :class="{ 'active': passwordActive || passwordHasContent }">
              <span v-for="(char, index) in '请输入密码'" :key="index" :style="{ transitionDelay: index * 0.05 + 's' }">{{
                char }}</span>
            </div>
          </div>
        </div> <!-- 关闭密码输入框的.form-group -->
        <!-- 添加验证码输入框 -->
        <div class="form-group"> <!-- 作为独立的.form-group -->
          <!-- 修改验证码输入框的v-model绑定 -->
          <div class="input-group captcha-row">
            <span class="input-icon"><i class="icon-shield"></i></span>
            <!-- 将v-model从captchaCode改为loginForm.captcha -->
            <input type="text" v-model="loginForm.captcha" class="form-control animated-input"
              @focus="handleInputFocus('captcha')" @blur="handleInputBlur('captcha')"
              @input="handleInputChange('captcha')">
            <!-- 添加浮动标签动画结构 -->
            <div class="floating-placeholder" :class="{ 'active': captchaActive || captchaHasContent }">
              <span v-for="(char, index) in '请输入验证码'" :key="index" :style="{ transitionDelay: index * 0.05 + 's' }">{{
                char }}</span>
            </div>
            <!-- 验证码图片容器 -->
            <div class="captcha-image-wrapper">
              <canvas ref="captchaCanvas" class="captcha-image" width="120" height="40"
                @click="refreshCaptcha"></canvas>
              <span class="refresh-text" @click="refreshCaptcha">看不清换一张</span>
            </div>
          </div>
        </div>
        <div class="form-options">
          <!-- 添加v-model绑定到rememberMe变量 -->
          <label class="checkbox-label">
            <input type="checkbox" class="form-checkbox" v-model="rememberMe"> 记住我
          </label>
          <router-link to="/reset-password" class="link">忘记密码?</router-link>
        </div>
        <div class="button-group">
          <button type="button" @click="handleLogin" class="btn login-btn">登录</button>
          <button type="button" @click="handleRegister" class="btn register-btn">注册</button>
        </div>
      </form>
    </div>

    <!-- 确保ref属性值与script中声明的变量名完全一致 -->
    <el-form ref="loginFormRef" :model="loginForm" :rules="rules" label-width="80px">
      <!-- 表单内容 -->
    </el-form>
    <!-- 系统错误提示弹窗 -->
    <div v-if="showSystemError" class="system-error-modal">
      <div class="modal-content">
        <div class="error-icon">⚠️</div>
        <div class="error-message">{{ systemErrorMsg }}</div>
        <button @click="closeError" class="confirm-btn">确定</button>
      </div>
    </div>
    <!-- 权限选择弹窗 -->
    <el-dialog v-model="showPermissionDialog" title="选择权限" width="30%">
      <el-radio-group v-model="selectedPermission" class="permission-radio-group">
        <el-radio v-for="option in permissionOptions" :key="option.value" :label="option.value">
          {{ option.label }}
        </el-radio>
      </el-radio-group>
      <template #footer>
        <el-button type="primary" @click="handlePermissionSelect">确认</el-button>
      </template>
    </el-dialog>
  </div>
</template>

<script setup>
// 将导入名称从request改为api
import api from '@/utils/api'
// 添加缺少的响应式变量声明
const systemErrorMsg = ref('');
const showSystemError = ref(false);
import { ref, reactive, onMounted, nextTick } from 'vue'
// import { useRouter } from 'vue-router';
import { ElMessage } from 'element-plus';
// 1. 在文件顶部导入路由
import router from '@/router';

// 添加注册按钮点击事件处理函数
const handleRegister = () => {
  router.push('/register');
};
// 声明表单引用
const rememberMe = ref(false);
const permissionOptions = ref([]); // 添加这行声明权限选项数组
// 添加权限对话框显示状态变量
const showPermissionDialog = ref(false);
// 添加选中的权限变量
const selectedPermission = ref('');
const loginFormRef = ref(null)
const loginForm = ref({
  username: '',
  password: '',
  // 添加验证码字段
  captcha: ''
});
// 添加表单验证规则
const rules = ref({
  password: [
    { required: true, message: '请输入密码', trigger: 'blur' },
    { min: 6, message: '密码长度不能少于 6 个字符', trigger: 'blur' },
    // 添加正则表达式验证规则
    {
      pattern: /^[0-9a-zA-Z]+$/,
      message: '密码只能包含数字和字母，不能使用特殊字符',
      trigger: 'blur'
    }
  ],
  captcha: [
    { required: true, message: '请输入验证码', trigger: 'blur' }
  ]
});
// 添加验证码相关变量
const captchaUrl = ref('');
const captchaText = ref(''); // 存储生成的验证码文本
const captchaCanvas = ref(null);


// 修复验证码生成逻辑
const generateCaptcha = () => {
  if (!captchaCanvas.value) {
    console.error('验证码Canvas元素未找到');
    return;
  }

  const ctx = captchaCanvas.value.getContext('2d');
  if (!ctx) {
    console.error('无法获取Canvas绘图上下文');
    return;
  }

  // 设置背景
  ctx.fillStyle = '#f5f5f5';
  ctx.fillRect(0, 0, 120, 40);

  // 生成随机验证码文本
  const chars = 'ABCDEFGHJKLMNPQRSTUVWXYZabcdefghjkmnpqrstuvwxyz23456789';
  captchaText.value = '';
  for (let i = 0; i < 4; i++) {
    captchaText.value += chars.charAt(Math.floor(Math.random() * chars.length));
  }

  // 绘制验证码文本
  ctx.font = 'bold 20px Arial';
  ctx.textAlign = 'center';
  ctx.textBaseline = 'middle';

  // 随机颜色和旋转效果
  for (let i = 0; i < 4; i++) {
    ctx.fillStyle = `rgb(${Math.random() * 100 + 50}, ${Math.random() * 100 + 50}, ${Math.random() * 100 + 50})`;
    ctx.save();
    ctx.translate(30 * i + 15, 20);
    ctx.rotate((Math.random() - 0.5) * 0.4);
    ctx.fillText(captchaText.value[i], 0, 0);
    ctx.restore();
  }

  // 添加干扰线
  for (let i = 0; i < 4; i++) {
    ctx.strokeStyle = `rgb(${Math.random() * 150}, ${Math.random() * 150}, ${Math.random() * 150})`;
    ctx.beginPath();
    ctx.moveTo(Math.random() * 120, Math.random() * 40);
    ctx.lineTo(Math.random() * 120, Math.random() * 40);
    ctx.lineWidth = 1;
    ctx.stroke();
  }

  // 添加干扰点
  for (let i = 0; i < 50; i++) {
    ctx.fillStyle = `rgb(${Math.random() * 200}, ${Math.random() * 200}, ${Math.random() * 200})`;
    ctx.beginPath();
    ctx.arc(Math.random() * 120, Math.random() * 40, 1, 0, 2 * Math.PI);
    ctx.fill();
  }
};


// 修复挂载时生成验证码
onMounted(() => {
  console.log('组件挂载完成，生成验证码');
  // 使用nextTick确保DOM已完全渲染
  nextTick(() => {
    refreshCaptcha();

    // 恢复记住的用户信息
    const rememberUser = localStorage.getItem('rememberedUser');
    if (rememberUser) {
      const user = JSON.parse(rememberUser);
      loginForm.value.username = user.username;
      loginForm.value.password = user.password;
      rememberMe.value = true;
      if (loginForm.value.username) usernameActive.value = true;
      if (loginForm.value.password) passwordActive.value = true;
    }
  });
});

// 修改验证码刷新方法
const refreshCaptcha = () => {
  // 使用前端生成的验证码替换后端请求
  captchaUrl.value = generateCaptcha();
  loginForm.value.captcha = '';
  captchaHasContent.value = false;
};


// 修改登录处理函数，添加验证码验证
const handleLogin = async () => {
  try {
    // 前端验证码验证
    if (loginForm.value.captcha.toUpperCase() !== captchaText.value.toUpperCase()) {
      systemErrorMsg.value = '验证码错误';
      showSystemError.value = true;
      refreshCaptcha(); // 验证失败刷新验证码
      return;
    }

    // 检查表单引用是否已正确绑定
    if (!loginFormRef.value) {
      throw new Error('表单引用未正确绑定，请检查ref属性是否正确设置')
    }
    // 执行表单验证
    await loginFormRef.value.validate()
    // 发送登录请求
    // 使用相对路径并通过代理转发请求
    // 现在可以正确使用api.post()
    const response = await api.post('/users/login', {
      username: loginForm.value.username,
      password: loginForm.value.password,
      // 移除后端验证码参数
      // captcha: loginForm.value.captcha,
      // 如果需要验证码UUID，这里添加: captchaId: captchaId.value
    })

    // 严格按照响应实例格式处理返回数据
    if (response.code === 200) {
      // 将permission改为permissions数组
      const { token, userId, username, permission } = response.data;
      // 修复ref对象访问方式，添加.value
      if (rememberMe.value) {
        localStorage.setItem('rememberedUser', JSON.stringify({
          username: loginForm.value.username,
          password: loginForm.value.password
        }));
      } else {
        localStorage.removeItem('rememberedUser');
      }
      // 删除这行: const vm = this;
      localStorage.setItem('token', token);
      localStorage.setItem('userId', userId);
      localStorage.setItem('username', username);
      // 存储权限数组（使用JSON.stringify转换）
      localStorage.setItem('permission', JSON.stringify(permission));
      ElMessage.success('登录成功');

      // 权限处理逻辑 - 替换原有的if-else判断
      const permissionRoute = {
        'SYSTEM_ADMINISTRATOR': '/admin-home',
        'DEVICE_ADMINISTRATOR': '/device-admin',
        'REPAIR_USER': '/wx-renyuan',
        'REGULAR_USER': '/user-home'
      };

      const permissionLabel = {
        'SYSTEM_ADMINISTRATOR': '系统管理员',
        'DEVICE_ADMINISTRATOR': '设备管理员',
        'REPAIR_USER': '维修人员',
        'REGULAR_USER': '普通用户'
      };

      // 根据权限数量决定跳转方式
      if (permission.length === 1) {
        // 单个权限直接跳转
        const redirectPath = permissionRoute[permission[0]] || '/dashboard';
        setTimeout(() => router.push(redirectPath), 1500);
      } else if (permission.length > 1) {
        // 多个权限显示选择弹窗
        permissionOptions.value = permission.map(perm => ({
          label: permissionLabel[perm] || perm,
          value: perm
        }));
        showPermissionDialog.value = true;
      }
    } else {
      errorMsg.value = response.msg;

      // 显示错误信息
      systemErrorMsg.value = errorMsg.value;
      showSystemError.value = true;
    }
  } catch (error) {
    console.error('登录失败:', error)
    systemErrorMsg.value = '其他错误';
    showSystemError.value = true;
  }
}
const usernameActive = ref(false);
const passwordActive = ref(false);
const usernameHasContent = ref(false);
const passwordHasContent = ref(false);

// 添加验证码相关状态
const captchaActive = ref(false);
const captchaHasContent = ref(false);

// 统一输入框处理方法
const handleInputFocus = (field) => {
  if (field === 'username') usernameActive.value = true;
  if (field === 'password') passwordActive.value = true;
  if (field === 'captcha') captchaActive.value = true;
};

const handleInputBlur = (field) => {
  if (field === 'username' && !loginForm.value.username) usernameActive.value = false;
  if (field === 'password' && !loginForm.value.password) passwordActive.value = false;
  // 修正未定义的captchaCode变量引用
  if (field === 'captcha' && !loginForm.value.captcha) captchaActive.value = false;
};

const handleInputChange = (field) => {
  if (field === 'username') usernameHasContent.value = !!username.value;
  if (field === 'password') passwordHasContent.value = !!password.value;
  // 修正未定义的captchaCode变量引用
  if (field === 'captcha') captchaHasContent.value = !!loginForm.value.captcha;
};
// 添加错误弹窗关闭方法
const closeError = () => {
  showSystemError.value = false;
}
// 添加权限选择处理方法
const handlePermissionSelect = () => {
  if (!selectedPermission.value) {
    systemErrorMsg.value = '请选择一个权限';
    showSystemError.value = true;
    return;
  }
  const permissionRoute = {
    'SYSTEM_ADMINISTRATOR': '/admin-home',
    'DEVICE_ADMINISTRATOR': '/device-admin',
    'REPAIR_USER': '/wx-renyuan',
    'REGULAR_USER': '/user-home'
  };
  const redirectPath = permissionRoute[selectedPermission.value] || '/dashboard';
  router.push(redirectPath);
  showPermissionDialog.value = false;
};
</script>

<style scoped>
/* 基础样式修正与美化 */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  padding: 20px;
}

.login-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  /* 四色渐变方案 - 电力系统专业蓝 */
  background: linear-gradient(135deg, #0a2463 0%, #2980b9 35%, #3e92cc 65%, #5dade2 100%);
  z-index: -2;
  /* 平滑过渡动画 */
  animation: gradientShift 15s ease infinite;
  background-size: 400% 400%;
}

.login-container::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  /* 白色漩涡光圈效果 */
  background-image:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 60%),
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0) 40%),
    radial-gradient(circle at 70% 70%, rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0) 40%);
  z-index: -1;
  /* 漩涡旋转动画 */
  animation: vortexRotate 20s linear infinite;
}

/* 渐变背景动画 */
@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

/* 漩涡旋转动画 */
@keyframes vortexRotate {
  0% {
    transform: rotate(0deg) scale(1);
    background-position: 50% 50%, 30% 30%, 70% 70%;
  }

  50% {
    transform: rotate(180deg) scale(1.1);
    background-position: 60% 40%, 40% 60%, 80% 20%;
  }

  100% {
    transform: rotate(360deg) scale(1);
    background-position: 50% 50%, 30% 30%, 70% 70%;
  }
}

.login-box {
  width: 100%;
  max-width: 400px;
  padding: 2.5rem;
  background-color: white;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.login-box:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-title {
  margin-bottom: 0.5rem;
  color: #2c3e50;
  font-size: 1.8rem;
  font-weight: 600;
}

.login-subtitle {
  color: #7f8c8d;
  font-size: 1rem;
}

/* 表单样式 */
.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  color: #34495e;
  font-weight: 500;
}

/* 确保动态提示样式仅应用于账号输入框 */
.input-group {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

/* 图标样式修正 */
.input-icon {
  position: absolute;
  left: 15px;
  color: #666;
  z-index: 1;
}

/* 输入框样式修正 */
.form-control {
  width: 100%;
  padding: 12px 15px 12px 45px;
  /* 左侧留出图标空间 */
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  text-align: center;
  /* 提示文字居中 */
}

/* 恢复并优化浮动标签动画 */
.floating-placeholder {
  display: flex !important;
  /* 恢复显示 */
  position: absolute;
  left: 45px;
  /* 与图标对齐 */
  top: 50%;
  transform: translateY(-50%);
  gap: 3px;
  color: #999;
  pointer-events: none;
  transition: all 0.3s ease;
}

.floating-placeholder.active {
  top: 10px;
  /* 停留在上方 */
  transform: translateY(0);
  font-size: 12px;
  color: #409EFF;
}

.floating-placeholder span {
  display: inline-block;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* 添加验证码输入框失焦动画 */
.floating-placeholder:not(.active) span {
  transform: translateY(15px);
  opacity: 0;
  transition: all 0.3s ease;
}

/* 输入框样式调整 */
.animated-input {
  padding: 16px 15px 8px 45px !important;
  text-align: left !important;
  /* 输入文字左对齐 */
}

/* 移除重复的.form-control定义，保留合并后的单一版本 */
.form-control {
  width: 100%;
  padding: 16px 15px 8px 45px !important;
  border: 1px solid #ddd;
  border-radius: 6px;
  box-sizing: border-box;
  font-size: 1rem;
  text-align: left;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* 确保未激活状态下的浮动标签可见 */
.floating-placeholder:not(.active) {
  opacity: 1;
}

/* 修复初始状态下的标签位置 */
.floating-placeholder {
  display: flex !important;
  position: absolute;
  left: 45px;
  top: 50%;
  transform: translateY(-50%);
  gap: 3px;
  color: #999;
  pointer-events: none;
  transition: all 0.3s ease;
  opacity: 1;
}

/* 增加输入框间距 */
.form-group {
  margin-bottom: 2.5rem;
  /* 从1.5rem增加到2.5rem，提供足够跳动空间 */
}

/* 恢复提示文字原始样式 */
.floating-placeholder.active {
  top: -8px;
  left: 45px;
  transform: translateY(0);
  font-size: 12px;
  color: #999;
  /* 恢复为原始灰色 */
  /* 保持无背景和内边距 */
}

/* 改进跳转动画 */
.floating-placeholder.active span {
  transform: translateY(-20px);
}

.floating-placeholder:not(.active) span {
  transform: translateY(0);
  opacity: 1;
}

/* 删除以下重复样式块 */
/*
.link { ... }
.icon-user::before { ... }
.icon-lock::before { ... }
.system-error-modal { ... }
*/


.form-control:focus {
  outline: none;
  border-color: #42b983;
  box-shadow: 0 0 0 3px rgba(66, 185, 131, 0.1);
}

/* 选项区域 */
.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  color: #7f8c8d;
  cursor: pointer;
}

.form-checkbox {
  margin-right: 6px;
}

/* 按钮样式 */
.button-group {
  display: flex;
  gap: 0.8rem;
  margin-bottom: 1.5rem;
}

.btn {
  flex: 1;
  padding: 0.9rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  transition: all 0.3s ease;
  text-decoration: none;
  /* 添加此行移除下划线 */
}

.login-btn {
  background-color: #42b983;
  color: white;
}

.login-btn:hover {
  background-color: #359469;
  transform: translateY(-2px);
}

.register-btn {
  background-color: #f5f5f5;
  color: #333;
  text-decoration: none;
  /* 确保没有下划线 */
}

.register-btn:hover {
  background-color: #e9e9e9;
  transform: translateY(-2px);
  text-decoration: none;
  /* 悬停时也无下划线 */
}

/* 链接样式 */
.extra-links {
  text-align: center;
  margin-top: 1rem;
}

.link {
  color: #42b983;
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s ease;
}

.link:hover {
  color: #359469;
  text-decoration: underline;
}

/* 图标样式模拟 */
.icon-user::before {
  content: '👤';
}

.icon-lock::before {
  content: '🔒';
}

/* 系统错误提示样式 */
.system-error-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  text-align: center;
  width: 300px;
}

.error-icon {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.confirm-btn {
  margin-top: 1rem;
  padding: 0.5rem 1rem;
  background: #409eff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

/* 恢复logo原始样式 */
.login-logo {
  position: absolute;
  top: 20px;
  /* 恢复原始顶部距离 */
  left: 20px;
  /* 恢复原始左侧距离 */
  z-index: 1;
}

/* 调整logo大小为原始尺寸的1.5倍（放大0.5倍） */
.logo-img {
  max-width: 180px;
  /* 原始120px × 1.5 = 180px */
  max-height: 120px;
  /* 原始80px × 1.5 = 120px */
  width: auto;
  height: auto;
  object-fit: contain;
}

/* 删除logo位置调整样式 */
/* 移除以下样式块 */
/*
.login-logo {
  top: 25px;
  left: 25px;
}

.login-box {
  margin-top: 60px;
}
*/

.link {
  color: #42b983;
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s ease;
}

.link:hover {
  color: #359469;
  text-decoration: underline;
}

/* 图标样式模拟 */
.icon-user::before {
  content: '👤';
}

.icon-lock::before {
  content: '🔒';
}

/* 系统错误提示样式 */
.system-error-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  text-align: center;
  width: 300px;
}

.error-icon {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.confirm-btn {
  margin-top: 1rem;
  padding: 0.5rem 1rem;
  background: #409eff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

/* 添加验证码行容器样式 */
.captcha-row {
  display: flex;
  align-items: center;
  gap: 10px;
  /* 添加验证码行顶部间距 */
}

/* 添加表单组统一间距样式 */
.form-group {
  margin-bottom: 30px;
  /* 调整此值可统一控制所有输入框行间距 */
  position: relative;
}

/* 验证码图片容器样式 */
.captcha-image-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* 确保输入框占满剩余空间 */
.captcha-row .form-control {
  flex: 1;
}

/* 验证码图片样式 */
.captcha-image {
  width: 120px;
  height: 40px;
  cursor: pointer;
  border-radius: 4px;
}

/* 刷新文本样式 */
.refresh-text {
  color: #409eff;
  font-size: 12px;
  cursor: pointer;
  margin-top: 4px;
}

/* 浮动标签动画样式（确保与账号密码框一致） */
.animated-input {
  /* 继承自现有animated-input的动画样式 */
  transition: all 0.3s ease;
}

.animated-input.active+label,
.animated-input:focus+label,
.animated-input:not(:placeholder-shown)+label {
  transform: translateY(-18px);
  font-size: 12px;
  color: #409eff;
}

.permission-radio-group {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 20px;
}

/* 添加权限选择对话框样式 */
::v-deep .permission-radio-group {
  text-align: left;
  padding-left: 20px;
}

::v-deep .el-radio {
  margin-bottom: 10px;
}
</style>
